<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2020/9/11 0011
  Time: 20:27
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="fnt" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/manage/js/lib/html5shiv.js"></script>
    <script type="text/javascript" src="/manage/js/lib/respond.min.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/manage/css/static/h-ui/css/H-ui.min.css" />
    <link rel="stylesheet" type="text/css" href="/manage/css/static/h-ui.admin/css/H-ui.admin.css" />
    <link rel="stylesheet" type="text/css" href="/manage/js/lib/Hui-iconfont/1.0.8/iconfont.css" />
    <link rel="stylesheet" type="text/css" href="/manage/css/static/h-ui.admin/skin/default/skin.css" id="skin" />
    <link rel="stylesheet" type="text/css" href="/manage/css/static/h-ui.admin/css/style.css" />
    <!--[if IE 6]>
    <script type="text/javascript" src="/manage/js/lib/DD_belatedPNG_0.0.8a-min.js" ></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <title>用户管理</title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 用户中心 <span class="c-gray en">&gt;</span> 用户管理 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
<div class="page-container">
    <div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
			<a href="javascript:;" onclick="addformaluser()" class="btn btn-primary radius">
                <i class="Hui-iconfont">&#xe600;</i>
                添加用户
            </a>
		</span>
    </div>
    <input type="hidden" class="hidden-examination-id" value="${examinationId}">
    <div class="mt-20">
        <table class="table table-border table-bordered table-hover table-bg table-sort">
            <thead>
            <tr class="text-c">
                <th><input type="checkbox" name="" value=""></th>
                <th>ID</th>
                <th>用户账号</th>
                <th>性别</th>
                <th>真实姓名</th>
                <th>学历</th>
                <th>岗位</th>
                <th>联系方式</th>
                <th>注册时间</th>
                <th>用户状态</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${userInfos}" var="userInfo" varStatus="stat">
                <tr class="text-c" style="text-align: center;">
                    <td><input type="checkbox" value="${userInfo.id}" name=""></td>
                    <td>${userInfo.id}</td>
                    <td class="text-l">
                        <a class="user-message">${userInfo.email}</a>
                    </td>
                    <input type="hidden" value="${userInfo.area}">
                    <input type="hidden" value="<f:formatDate value="${userInfo.birthday}" pattern="yyyy-MM-dd"></f:formatDate>">
                    <td>${userInfo.sex}</td>
                    <td>${userInfo.userName}</td>
                    <td>${userInfo.education.educationName}</td>
                    <td>${userInfo.post.postName}</td>
                    <td>${userInfo.phone}</td>
                    <td>
                        <f:formatDate value="${userInfo.creatTime}" pattern="yyyy-MM-dd"></f:formatDate>
                    </td>
                    <td class="status-user">
                        <c:if test="${userInfo.vipUser == 0}">
                            普通用户
                        </c:if>
                        <c:if test="${userInfo.vipUser == 1}">
                            待审核
                        </c:if>
                        <c:if test="${userInfo.vipUser == 2}">
                            审核未通过
                        </c:if>
                        <c:if test="${userInfo.vipUser == 3}">
                            内测用户
                        </c:if>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="/manage/js/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/manage/js/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/manage/css/static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="/manage/css/static/h-ui.admin/js/H-ui.admin.js"></script>
<!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="/manage/js/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="/manage/js/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="/manage/js/lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
    $(function(){
        $('.table-sort').dataTable({
            "aaSorting": [[ 1, "desc" ]],//默认第几个排序
            "bStateSave": true,//状态保存
            "aoColumnDefs": [
                //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
                {"orderable":false,"aTargets":[0,8,9]}// 制定列不参与排序
            ]
        });

    });

    //获取ids,批量导入考试用户
    function addformaluser() {
        var ids='';
        $('input:checkbox').each(function () {
            if(this.checked==true){
                ids+=this.value+',';
            }
        });
        if(ids==''){
            layer.alert("请选择导入用户选项");return;
        }
        var strs_ids=new Array();
        var str_1=ids.replace(/\s*/g,"");//去掉空格-字符串
        var str_2=str_1.replace(/^,+/,"").replace(/,+$/,"");//去掉首尾逗号
        strs=str_2.split(",");
        for (i = 0; i <strs.length ; i++) {
            //分割后的字符串输出
            strs_ids.push(strs[i]);
        }
        var examinationId=$(".hidden-examination-id").val();
        var ids=strs_ids.toString();
        layer.confirm('批量导入考试用户,请确认!',function (index) {
            var data={ids:ids,examinationId:examinationId};
            $.ajax({
                type:'post',
                url:'/manage/examination/batch-select-user',
                data:data,
                success:function(){
                    layer.msg('已添加!',{icon:1,time:1000});
                    $("input:checkbox[name=select]").prop("checked",false);
                }
            });
        });
    }
</script>
</body>
</html>